/*
package com.atguigu.lease.web.admin.custom.config;

import com.atguigu.lease.model.enums.BaseEnum;
import com.atguigu.lease.model.enums.ItemType;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.lang.reflect.Field;

@Component
//public class StringToBaseEnumConverterFactory implements Converter<String, T extends BaseEnum> {
public class StringToBaseEnumConverterFactory implements Converter<String, BaseEnum> {

    @Override
    public BaseEnum convert(String source) {

        BaseEnum baseEnum = null;

        Field[] fields = BaseEnum.class.getFields();

        for (Field field : fields) {
            if (field.getName().startsWith(source)) {}
        }











        BaseEnum[] values = BaseEnum;
        for (ItemType value : values) {
            if (value.getCode().toString().equals(source)) {
                baseEnum = value;
                break;
            }
        }

        return baseEnum;
    }
}
*/
